home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Pane2 / c / ReadIcon < prev    next >
Text File  |  1995-08-23  |  3KB  |  86 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Pane2.ReadIcon.c
  12.     Author:  Copyright © 1995 Andrew Sellors.
  13.     Version: 1.04 (4th August 1995)
  14.     Purpose: Handles windows with panes.
  15. */
  16.  
  17. #include "DeskLib:Pane2.h"
  18. #include "Pane2Defs.h"
  19. #include "Desklib:Event.h"
  20. #include "DeskLib:Template.h"
  21. #include "Desklib:EventMsg.h"
  22. #include "Desklib:Error.h"
  23.  
  24. #include <stdlib.h>
  25.  
  26.  
  27. /******************************************************************************/
  28.  
  29. extern void Pane2_ReadIcon(window_handle window, icon_handle icon, char *panewindow,
  30.                            wimp_point *paneoffset, wimp_point *panesize)
  31. {
  32.  /*
  33.   * Calculates the pane offset and size so that the pane will be in the same
  34.   * position and size as the icon in the window.
  35.   * If 'panewindow' is the name of the pane window in the template file then the
  36.   * presence of any scroll bars or the window title bar is taken into accound
  37.   * when calculating the position and size of the pane, set it to NULL and no
  38.   * action is taken.
  39.   * Need to use pane2_MAINTOP and pane2_PANETOP flags.
  40.   */
  41.   icon_block iconinfo;
  42.   window_block *block;
  43.  
  44.   Wimp_GetIconState(window, icon, &iconinfo);
  45.  
  46.   panesize->x = iconinfo.workarearect.max.x - iconinfo.workarearect.min.x;
  47.   panesize->y = iconinfo.workarearect.max.y - iconinfo.workarearect.min.y;
  48.   
  49.   paneoffset->x = iconinfo.workarearect.min.x;
  50.   paneoffset->y = -iconinfo.workarearect.max.y;
  51.  
  52.  /*
  53.   * Try and correct size to take into acount scroll bars etc.
  54.   * Should use difference between window outline and window openpos to find
  55.   * tool size but this requires the window to be already open.
  56.   */
  57.   if(panewindow != NULL){ 
  58.  
  59.      block = Template_Find(panewindow);
  60.  
  61.      if(block != NULL){
  62.  
  63.         if(block->flags.data.hastitle || block->flags.data.titlebar){ /* title bar */
  64.  
  65.            paneoffset->y += tool_SIZE;
  66.            panesize->y -= tool_SIZE;
  67.  
  68.         }
  69.  
  70.         if(block->flags.data.hasvscroll || block->flags.data.vscroll){ /* vert scroll */
  71.  
  72.            panesize->x -= tool_SIZE;
  73.  
  74.         }
  75.  
  76.         if(block->flags.data.hashscroll || block->flags.data.hscroll){ /* horz scroll */
  77.  
  78.            panesize->y -= tool_SIZE;
  79.  
  80.         }
  81.  
  82.      }
  83.  
  84.   }
  85. }
  86.